This notebook will demonstrate the use of a neural network to classify face images. The classifier will attempt to distinguish between faces turning left and faces turning right. We will vary the number of nodes in the hidden layer to examine the effect on performance.

First we load the appropriate libraries:

In [1]:
library(pixmap)
library(gdata)
gdata: Unable to locate valid perl interpreter
gdata: 
gdata: read.xls() will be unable to read Excel XLS and XLSX files
gdata: unless the 'perl=' argument is used to specify the location of a
gdata: valid perl intrpreter.
gdata: 
gdata: (To avoid display of this message in the future, please ensure
gdata: perl is installed and available on the executable search path.)
gdata: Unable to load perl libaries needed by read.xls()
gdata: to support 'XLX' (Excel 97-2004) files.

gdata: Unable to load perl libaries needed by read.xls()
gdata: to support 'XLSX' (Excel 2007+) files.

gdata: Run the function 'installXLSXsupport()'
gdata: to automatically download and install the perl
gdata: libaries needed to support Excel XLS and XLSX formats.

Attaching package: 'gdata'

The following object is masked from 'package:stats':

    nobs

The following object is masked from 'package:utils':

    object.size

The following object is masked from 'package:base':

    startsWith

Here are examples of the face data:

In [5]:
left1<-read.pnm(file="Homework 4 Face Dataset/Left/left1.pgm")
plot(left1)
Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"
In [6]:
right1<-read.pnm(file="Homework 4 Face Dataset/Right/right1.pgm")
plot(right1)
Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"

Next we train the network. We will randomize the data and then use 80% of it to train the neural network and 20% of it to test the data.

We first use the following function to load the data:

In [7]:
loadImages <- function(pathName,fileNames, clasLabel) 
{
files<-list.files(path=pathName,pattern=fileNames,all.files=T,full.name=T,no..=T)
list_of_images=lapply(files,read.pnm)
plot(list_of_images[[1]])
n.images<-length(list_of_images)
image.matrix<-list_of_images[[1]]@grey
image.vector<-unmatrix(image.matrix,byrow=T)
for(ii in 2:n.images)
{
 i.matrix<-list_of_images[[ii]]@grey
 i.vector<-unmatrix(i.matrix,byrow=T)
 image.vector<-rbind(image.vector,i.vector)
}
image.frame<-data.frame(image.vector)
n.rows<-nrow(image.frame)
class1.label<-rep(clasLabel,n.rows)
image.frame<-cbind(image.frame,class1.label)
return (image.frame)
}
In [9]:
left.frame <- loadImages("Homework 4 Face Dataset/Left", "left*.*", 0)
left.frame
Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"
r1.c1r1.c2r1.c3r1.c4r1.c5r1.c6r1.c7r1.c8r1.c9r1.c10...r60.c56r60.c57r60.c58r60.c59r60.c60r60.c61r60.c62r60.c63r60.c64class1.label
image.vector0.10897436 0.0064102560.05128205 0.37179487 0.21794872 0.1538462 0.1666667 0.1602564 0.3461538 0.3846154 ... 0.53205128 0.65384615 0.3333333330.51282051 0.30769231 0.3910256410.52564103 0.37820513 0.0448717950
i.vector0.20769231 0.2000000000.20000000 0.19230769 0.18461538 0.1769231 0.1692308 0.1692308 0.1615385 0.1538462 ... 0.86923077 0.50000000 0.0076923080.03076923 0.03846154 0.1461538460.22307692 0.22307692 0.2153846150
i.vector.10.18852459 0.1803278690.17213115 0.16393443 0.16393443 0.1557377 0.1557377 0.1475410 0.1393443 0.1311475 ... 0.90163934 0.90163934 0.9016393440.90163934 0.70491803 0.1885245900.22131148 0.21311475 0.2049180330
i.vector.20.20634921 0.1984126980.19841270 0.19047619 0.18253968 0.1746032 0.1746032 0.1666667 0.1587302 0.1587302 ... 0.92063492 0.61904762 0.0238095240.03174603 0.03968254 0.1428571430.22222222 0.21428571 0.2142857140
i.vector.30.17500000 0.1750000000.16666667 0.16666667 0.15833333 0.1500000 0.1500000 0.1416667 0.1333333 0.1250000 ... 0.91666667 0.91666667 0.9166666670.91666667 0.80833333 0.4416666670.21666667 0.21666667 0.2083333330
i.vector.40.20000000 0.1920000000.19200000 0.18400000 0.17600000 0.1680000 0.1680000 0.1600000 0.1520000 0.1440000 ... 0.88800000 0.50400000 0.0000000000.02400000 0.04000000 0.1360000000.21600000 0.21600000 0.2080000000
i.vector.50.19834711 0.1900826450.18181818 0.17355372 0.17355372 0.1652893 0.1570248 0.1487603 0.1487603 0.1404959 ... 0.90909091 0.91735537 0.6859504130.03305785 0.04132231 0.1322314050.20661157 0.20661157 0.1983471070
i.vector.60.19841270 0.1984126980.19047619 0.18253968 0.17460317 0.1746032 0.1666667 0.1587302 0.1587302 0.1507937 ... 0.88888889 0.51587302 0.0079365080.03174603 0.03968254 0.1428571430.22222222 0.22222222 0.2222222220
i.vector.70.24161074 0.2281879190.22147651 0.21476510 0.21476510 0.2080537 0.2013423 0.2013423 0.1946309 0.1879195 ... 0.26174497 0.26845638 0.2684563760.26845638 0.26174497 0.2617449660.26174497 0.25503356 0.2416107380
i.vector.80.21935484 0.2129032260.21290323 0.20645161 0.20000000 0.1935484 0.1870968 0.1806452 0.1806452 0.1741935 ... 0.28387097 0.27741935 0.2645161290.25161290 0.23870968 0.2258064520.21290323 0.20645161 0.2000000000
i.vector.90.24324324 0.2297297300.22297297 0.21621622 0.20945946 0.2094595 0.2027027 0.2027027 0.1959459 0.1891892 ... 0.25675676 0.26351351 0.2635135140.26351351 0.26351351 0.2635135140.25675676 0.25000000 0.2364864860
i.vector.100.00000000 0.0000000000.00000000 0.00000000 0.00000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 ... 0.33544304 0.36075949 0.3164556960.46835443 0.15822785 0.1075949370.04430380 0.02531646 0.0000000000
i.vector.110.21935484 0.2129032260.20645161 0.20645161 0.20000000 0.1935484 0.1870968 0.1806452 0.1741935 0.1677419 ... 0.28387097 0.27741935 0.2645161290.25161290 0.23870968 0.2258064520.21290323 0.20000000 0.2000000000
i.vector.120.22368421 0.2171052630.21710526 0.21052632 0.21052632 0.2039474 0.1973684 0.1907895 0.1842105 0.1842105 ... 0.26315789 0.25657895 0.2565789470.25657895 0.24342105 0.2368421050.22368421 0.21052632 0.1973684210
i.vector.130.22580645 0.2258064520.21935484 0.21290323 0.20645161 0.2000000 0.2000000 0.1870968 0.1870968 0.1806452 ... 0.28387097 0.27741935 0.2645161290.25161290 0.23870968 0.2258064520.21290323 0.20645161 0.1935483870
i.vector.140.24000000 0.2266666670.22000000 0.21333333 0.21333333 0.2066667 0.2066667 0.1933333 0.1933333 0.1866667 ... 0.26000000 0.26000000 0.2600000000.26666667 0.26666667 0.2600000000.26000000 0.25333333 0.2400000000
i.vector.150.22580645 0.2193548390.21290323 0.21290323 0.20645161 0.2064516 0.2000000 0.1935484 0.1870968 0.1741935 ... 0.28387097 0.27741935 0.2645161290.25161290 0.23870968 0.2258064520.21290323 0.20645161 0.1935483870
i.vector.160.20800000 0.2000000000.20000000 0.18400000 0.17600000 0.1760000 0.1680000 0.1600000 0.1520000 0.1440000 ... 0.91200000 0.90400000 0.8960000000.88000000 0.81600000 0.1760000000.21600000 0.21600000 0.2160000000
i.vector.170.20800000 0.2000000000.19200000 0.18400000 0.18400000 0.1760000 0.1680000 0.1600000 0.1600000 0.1520000 ... 0.90400000 0.91200000 0.9040000000.92000000 0.46400000 0.1680000000.22400000 0.21600000 0.2160000000
i.vector.180.20967742 0.2096774190.20161290 0.19354839 0.18548387 0.1854839 0.1693548 0.1693548 0.1612903 0.1532258 ... 0.91129032 0.91129032 0.8951612900.89516129 0.89516129 0.2580645160.21774194 0.20967742 0.2096774190
i.vector.190.20800000 0.2000000000.19200000 0.19200000 0.18400000 0.1760000 0.1680000 0.1680000 0.1600000 0.1520000 ... 0.91200000 0.90400000 0.9040000000.91200000 0.54400000 0.1600000000.22400000 0.21600000 0.2160000000
i.vector.200.20967742 0.1935483870.19354839 0.17741935 0.16935484 0.1693548 0.1693548 0.1612903 0.1451613 0.1451613 ... 0.91129032 0.91129032 0.9112903230.89516129 0.91129032 0.3629032260.22580645 0.21774194 0.2177419350
i.vector.210.10897436 0.0000000000.05128205 0.38461538 0.22435897 0.1538462 0.1730769 0.1666667 0.3525641 0.3974359 ... 0.73076923 0.51282051 0.2820512820.30769231 0.35897436 0.4102564100.20512821 0.03205128 0.0064102560
i.vector.220.20800000 0.2080000000.20000000 0.19200000 0.18400000 0.1760000 0.1760000 0.1680000 0.1600000 0.1520000 ... 0.90400000 0.89600000 0.9040000000.90400000 0.49600000 0.1680000000.21600000 0.20800000 0.2080000000
i.vector.230.20161290 0.1935483870.18548387 0.17741935 0.17741935 0.1693548 0.1612903 0.1612903 0.1532258 0.1451613 ... 0.91129032 0.91129032 0.9112903230.88709677 0.90322581 0.4354838710.21774194 0.21774194 0.2096774190
i.vector.240.20634921 0.1984126980.19841270 0.19047619 0.18253968 0.1746032 0.1666667 0.1587302 0.1507937 0.1507937 ... 0.88095238 0.90476190 0.8809523810.89682540 0.61111111 0.1587301590.21428571 0.20634921 0.2063492060
i.vector.250.21428571 0.2936507940.24603175 0.23809524 0.23809524 0.2301587 0.2301587 0.2222222 0.2222222 0.2142857 ... 0.84126984 0.83333333 0.7857142860.36507937 0.00000000 0.0000000000.00000000 0.00000000 0.0000000000
i.vector.260.08029197 0.0802919710.08029197 0.08029197 0.09489051 0.1824818 0.2189781 0.2116788 0.2116788 0.2043796 ... 0.73722628 0.75182482 0.7518248180.75182482 0.72262774 0.6423357660.15328467 0.00000000 0.0000000000
i.vector.270.20634921 0.2857142860.23809524 0.23809524 0.23015873 0.2301587 0.2222222 0.2222222 0.2142857 0.2063492 ... 0.84126984 0.84126984 0.7857142860.35714286 0.00000000 0.0000000000.00000000 0.00000000 0.0000000000
i.vector.280.08759124 0.0875912410.08759124 0.08759124 0.10218978 0.1897810 0.2189781 0.2116788 0.2116788 0.2116788 ... 0.72992701 0.73722628 0.7445255470.74452555 0.71532847 0.6277372260.15328467 0.00000000 0.0000000000
i.vector.290.21428571 0.2936507940.24603175 0.23809524 0.23809524 0.2380952 0.2301587 0.2222222 0.2222222 0.2222222 ... 0.84920635 0.84126984 0.7936507940.37301587 0.00000000 0.0000000000.00000000 0.00000000 0.0000000000
i.vector.300.07407407 0.0740740740.07407407 0.08148148 0.08888889 0.1851852 0.2148148 0.2148148 0.2074074 0.2000000 ... 0.75555556 0.75555556 0.7629629630.75555556 0.72592593 0.6296296300.11851852 0.00000000 0.0000000000
i.vector.310.21600000 0.2960000000.24800000 0.24800000 0.24000000 0.2400000 0.2400000 0.2320000 0.2320000 0.2240000 ... 0.86400000 0.84800000 0.8080000000.44800000 0.00000000 0.0000000000.00000000 0.00000000 0.0000000000
i.vector.320.11464968 0.0063694270.06369427 0.40127389 0.22929936 0.1592357 0.1783439 0.1719745 0.3630573 0.4012739 ... 0.56050955 0.53503185 0.3375796180.35031847 0.14012739 0.1146496820.05095541 0.02547771 0.0000000000
i.vector.330.08759124 0.0802919710.08029197 0.08759124 0.09489051 0.1897810 0.2262774 0.2189781 0.2189781 0.2116788 ... 0.73722628 0.74452555 0.7518248180.74452555 0.71532847 0.6204379560.11678832 0.00000000 0.0000000000
i.vector.340.02816901 0.2605633800.20422535 0.20422535 0.19718310 0.1971831 0.1901408 0.1901408 0.1901408 0.1830986 ... 0.85211268 0.84507042 0.8450704230.82394366 0.80281690 0.2253521130.00000000 0.00000000 0.0000000000
i.vector.350.02962963 0.2592592590.20000000 0.20000000 0.19259259 0.1925926 0.1925926 0.1851852 0.1851852 0.1777778 ... 0.89629630 0.88888889 0.8962962960.88888889 0.85925926 0.7851851850.08888889 0.00000000 0.0000000000
i.vector.360.02816901 0.2676056340.21126761 0.21126761 0.20422535 0.1971831 0.2042254 0.1971831 0.1971831 0.1901408 ... 0.89436620 0.88732394 0.8802816900.88028169 0.87323944 0.4647887320.00000000 0.00000000 0.0000000000
i.vector.370.02222222 0.2592592590.20000000 0.20000000 0.19259259 0.1925926 0.1925926 0.1925926 0.1851852 0.1851852 ... 0.90370370 0.90370370 0.8962962960.89629630 0.88888889 0.8222222220.13333333 0.00000000 0.0000000000
i.vector.380.02898551 0.2681159420.20289855 0.21014493 0.20289855 0.2028986 0.1956522 0.1956522 0.1956522 0.1884058 ... 0.89855072 0.89130435 0.8913043480.89130435 0.88405797 0.7608695650.02173913 0.00000000 0.0000000000
i.vector.390.02222222 0.2592592590.20000000 0.19259259 0.19259259 0.1851852 0.1851852 0.1851852 0.1851852 0.1777778 ... 0.88888889 0.88888889 0.8814814810.88148148 0.88148148 0.8370370370.32592593 0.00000000 0.0000000000
i.vector.400.02777778 0.2638888890.20833333 0.20833333 0.20138889 0.2013889 0.2013889 0.1944444 0.1944444 0.1875000 ... 0.89583333 0.88888889 0.8888888890.88194444 0.83333333 0.1736111110.00000000 0.00000000 0.0000000000
i.vector.410.02205882 0.2573529410.19117647 0.19117647 0.19117647 0.1911765 0.1838235 0.1838235 0.1838235 0.1764706 ... 0.88970588 0.88970588 0.8897058820.88235294 0.85294118 0.7647058820.07352941 0.00000000 0.0000000000
i.vector.420.26623377 0.2597402600.25324675 0.24025974 0.23376623 0.2337662 0.2272727 0.2207792 0.2142857 0.2077922 ... 0.11038961 0.11038961 0.0844155840.09740260 0.08441558 0.2402597400.27922078 0.27272727 0.2792207790
i.vector.430.28846154 0.3653846150.21794872 0.23076923 0.23717949 0.3012821 0.4230769 0.3717949 0.3205128 0.3012821 ... 0.16666667 0.07692308 0.1282051280.07692308 0.02564103 0.0064102560.00000000 0.00000000 0.0000000000
i.vector.440.27272727 0.2597402600.25324675 0.24675325 0.24025974 0.2337662 0.2272727 0.2207792 0.2142857 0.2077922 ... 0.08441558 0.09740260 0.0909090910.07142857 0.12337662 0.2727272730.28571429 0.27922078 0.2792207790
i.vector.450.11464968 0.0063694270.07006369 0.40764331 0.23566879 0.1656051 0.1847134 0.1783439 0.3757962 0.4140127 ... 0.34394904 0.51592357 0.5350318470.30573248 0.29299363 0.1146496820.05732484 0.03184713 0.0000000000
i.vector.460.10191083 0.0063694270.05095541 0.37579618 0.21656051 0.1528662 0.1656051 0.1656051 0.3439490 0.3885350 ... 0.48407643 0.51592357 0.3503184710.42038217 0.21656051 0.4840764330.50318471 0.05095541 0.0000000000
i.vector.470.11538462 0.0064102560.05769231 0.40384615 0.23076923 0.1602564 0.1794872 0.1730769 0.3653846 0.4102564 ... 0.55128205 0.62179487 0.3205128210.35897436 0.17948718 0.1153846150.05769231 0.02564103 0.0000000000
i.vector.480.19512195 0.1951219510.18699187 0.17886179 0.17073171 0.1707317 0.1626016 0.1626016 0.1463415 0.1463415 ... 0.91056911 0.29268293 0.0081300810.03252033 0.04065041 0.1382113820.21951220 0.21138211 0.2113821140
In [10]:
right.frame<-loadImages("Homework 4 Face Dataset/Right", "right*.*", 1)
right.frame
Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"Warning message in rep(cellres, length = 2):
"'x' is NULL so the result will be NULL"
r1.c1r1.c2r1.c3r1.c4r1.c5r1.c6r1.c7r1.c8r1.c9r1.c10...r60.c56r60.c57r60.c58r60.c59r60.c60r60.c61r60.c62r60.c63r60.c64class1.label
image.vector0.11612903 0.0064516130.05806452 0.40000000 0.23225806 0.1612903 0.1806452 0.1741935 0.3677419 0.4129032 ... 0.6645161 0.7096774 0.3806451610.26451613 0.49032258 0.4193548390.53548387 0.55483871 0.3741935481
i.vector0.22047244 0.2125984250.20472441 0.18897638 0.18110236 0.1811024 0.1732283 0.1732283 0.1653543 0.1653543 ... 0.9212598 0.8031496 0.4094488190.03149606 0.03937008 0.1338582680.21259843 0.22047244 0.2125984251
i.vector.10.19166667 0.1833333330.17500000 0.17500000 0.16666667 0.1583333 0.1583333 0.1500000 0.1416667 0.1416667 ... 0.9166667 0.9166667 0.9166666670.91666667 0.81666667 0.4166666670.21666667 0.21666667 0.2083333331
i.vector.20.20161290 0.2016129030.19354839 0.19354839 0.18548387 0.1774194 0.1693548 0.1612903 0.1612903 0.1532258 ... 0.9274194 0.7500000 0.0967741940.03225806 0.04032258 0.1451612900.21774194 0.21774194 0.2177419351
i.vector.30.19327731 0.1848739500.18487395 0.17647059 0.16806723 0.1596639 0.1512605 0.1512605 0.1428571 0.1428571 ... 0.9243697 0.9243697 0.9159663870.91596639 0.82352941 0.5210084030.21848739 0.21848739 0.2100840341
i.vector.40.19200000 0.1920000000.19200000 0.18400000 0.17600000 0.1680000 0.1600000 0.1600000 0.1520000 0.1440000 ... 0.8960000 0.6800000 0.0400000000.02400000 0.04000000 0.1360000000.20000000 0.20000000 0.2000000001
i.vector.50.19166667 0.1916666670.18333333 0.18333333 0.17500000 0.1750000 0.1666667 0.1583333 0.1500000 0.1500000 ... 0.9166667 0.9166667 0.6083333330.03333333 0.04166667 0.1333333330.20833333 0.20833333 0.2000000001
i.vector.60.20161290 0.1935483870.19354839 0.18548387 0.17741935 0.1693548 0.1612903 0.1612903 0.1532258 0.1532258 ... 0.9274194 0.7500000 0.1129032260.03225806 0.04032258 0.1451612900.22580645 0.21774194 0.2177419351
i.vector.70.23026316 0.2302631580.22368421 0.21710526 0.21052632 0.2039474 0.2039474 0.1973684 0.1842105 0.1776316 ... 0.2434211 0.2105263 0.1842105260.35526316 0.31578947 0.3223684210.32236842 0.32236842 0.3157894741
i.vector.80.23566879 0.2229299360.22292994 0.21656051 0.21019108 0.2038217 0.2038217 0.1974522 0.1910828 0.1847134 ... 0.2993631 0.2675159 0.3694267520.23566879 0.31847134 0.3184713380.31210191 0.31210191 0.3057324841
i.vector.90.22666667 0.2200000000.21333333 0.20666667 0.20666667 0.2000000 0.1933333 0.1933333 0.1866667 0.1800000 ... 0.2933333 0.2266667 0.1600000000.32000000 0.32000000 0.3200000000.32000000 0.32000000 0.3200000001
i.vector.100.12101911 0.0063694270.06369427 0.40764331 0.23566879 0.1656051 0.1847134 0.1783439 0.3757962 0.4140127 ... 0.3757962 0.6242038 0.6242038220.33121019 0.39490446 0.2611464970.05732484 0.03184713 0.0000000001
i.vector.110.23076923 0.2243589740.22435897 0.21794872 0.21153846 0.2051282 0.1987179 0.1987179 0.1923077 0.1858974 ... 0.3012821 0.2692308 0.3589743590.24358974 0.32051282 0.3205128210.32051282 0.31410256 0.3076923081
i.vector.120.23178808 0.2251655630.22516556 0.21854305 0.21192053 0.2052980 0.1986755 0.1920530 0.1920530 0.1854305 ... 0.2516556 0.2119205 0.1721854300.35761589 0.31125828 0.3178807950.31788079 0.31788079 0.3178807951
i.vector.130.23717949 0.2307692310.22435897 0.21794872 0.21794872 0.2051282 0.2051282 0.1987179 0.1923077 0.1858974 ... 0.3333333 0.3782051 0.2948717950.22435897 0.32051282 0.3141025640.30769231 0.30128205 0.2948717951
i.vector.140.22516556 0.2185430460.21192053 0.21192053 0.20529801 0.1986755 0.1920530 0.1854305 0.1788079 0.1721854 ... 0.3178808 0.2185430 0.1655629140.28476821 0.31788079 0.3178807950.31788079 0.31788079 0.3178807951
i.vector.150.23076923 0.2243589740.21794872 0.21153846 0.21153846 0.2051282 0.2051282 0.1923077 0.1858974 0.1858974 ... 0.3076923 0.3076923 0.3525641030.24358974 0.31410256 0.3141025640.31410256 0.31410256 0.3012820511
i.vector.160.20325203 0.1951219510.18699187 0.17886179 0.17073171 0.1707317 0.1626016 0.1544715 0.1544715 0.1463415 ... 0.9105691 0.9105691 0.9105691060.89430894 0.90243902 0.8455284550.22764228 0.21138211 0.2113821141
i.vector.170.20325203 0.2032520330.19512195 0.18699187 0.17886179 0.1788618 0.1707317 0.1626016 0.1544715 0.1463415 ... 0.9105691 0.9024390 0.9105691060.90243902 0.91056911 0.5934959350.21951220 0.21951220 0.2113821141
i.vector.180.20491803 0.1967213110.18852459 0.18852459 0.18032787 0.1721311 0.1639344 0.1557377 0.1557377 0.1475410 ... 0.9098361 0.9098361 0.9098360660.90163934 0.90983607 0.5245901640.21311475 0.21311475 0.2049180331
i.vector.190.20491803 0.2049180330.19672131 0.18852459 0.18032787 0.1721311 0.1639344 0.1639344 0.1557377 0.1475410 ... 0.9098361 0.9098361 0.9098360660.90163934 0.90163934 0.6639344260.20491803 0.20491803 0.2049180331
i.vector.200.20491803 0.1967213110.18852459 0.18032787 0.18032787 0.1721311 0.1721311 0.1639344 0.1557377 0.1475410 ... 0.9098361 0.9098361 0.9098360660.90163934 0.90163934 0.5491803280.21311475 0.20491803 0.2049180331
i.vector.210.10828025 0.0063694270.05732484 0.38853503 0.22292994 0.1592357 0.1719745 0.1656051 0.3566879 0.3949045 ... 0.5796178 0.7197452 0.7261146500.37579618 0.43949045 0.3375796180.42675159 0.45859873 0.2484076431
i.vector.220.20325203 0.1951219510.18699187 0.17886179 0.17073171 0.1707317 0.1626016 0.1544715 0.1463415 0.1463415 ... 0.9105691 0.9105691 0.9024390240.90243902 0.91056911 0.6260162600.21951220 0.21951220 0.2113821141
i.vector.230.20491803 0.1967213110.18852459 0.17213115 0.17213115 0.1639344 0.1639344 0.1557377 0.1475410 0.1393443 ... 0.9098361 0.9098361 0.9098360660.89344262 0.90163934 0.6147540980.21311475 0.21311475 0.2049180331
i.vector.240.20325203 0.1951219510.19512195 0.18699187 0.17886179 0.1707317 0.1707317 0.1544715 0.1544715 0.1463415 ... 0.9024390 0.9105691 0.9105691060.90243902 0.90243902 0.3902439020.21951220 0.21138211 0.2032520331
i.vector.250.21052632 0.2781954890.23308271 0.23308271 0.22556391 0.2255639 0.2255639 0.2180451 0.2180451 0.2105263 ... 0.7669173 0.7593985 0.6992481200.20300752 0.00000000 0.0000000000.00000000 0.00000000 0.0000000001
i.vector.260.07746479 0.0704225350.07042254 0.07746479 0.09154930 0.1690141 0.1971831 0.1971831 0.1901408 0.1901408 ... 0.6971831 0.7042254 0.7042253520.71126761 0.65492958 0.6408450700.57042254 0.04225352 0.0000000001
i.vector.270.20300752 0.2781954890.22556391 0.22556391 0.22556391 0.2180451 0.2180451 0.2105263 0.2105263 0.2030075 ... 0.7669173 0.7518797 0.7067669170.25563910 0.00000000 0.0000000000.00000000 0.00000000 0.0000000001
i.vector.280.07801418 0.0709219860.07092199 0.07801418 0.09219858 0.1702128 0.1985816 0.1985816 0.1985816 0.1914894 ... 0.7021277 0.7021277 0.7092198580.70921986 0.65248227 0.6453900710.53900709 0.02836879 0.0000000001
i.vector.290.21804511 0.2932330830.24060150 0.24060150 0.24060150 0.2330827 0.2330827 0.2255639 0.2180451 0.2180451 ... 0.7669173 0.7593985 0.7067669170.22556391 0.00000000 0.0000000000.00000000 0.00000000 0.0000000001
i.vector.300.07042254 0.0774647890.07042254 0.07746479 0.09154930 0.1690141 0.2042254 0.1971831 0.1901408 0.1901408 ... 0.6971831 0.6971831 0.7112676060.70422535 0.64788732 0.6478873240.52816901 0.02112676 0.0000000001
i.vector.310.21052632 0.2857142860.24060150 0.24060150 0.23308271 0.2255639 0.2255639 0.2255639 0.2180451 0.2105263 ... 0.7669173 0.7593985 0.7067669170.19548872 0.00000000 0.0000000000.00000000 0.00000000 0.0000000001
i.vector.320.12101911 0.0063694270.06369427 0.41401274 0.23566879 0.1656051 0.1847134 0.1783439 0.3694268 0.4203822 ... 0.3630573 0.6050955 0.6433121020.33757962 0.37579618 0.2675159240.06369427 0.03821656 0.0000000001
i.vector.330.06993007 0.0699300700.06993007 0.07692308 0.08391608 0.1608392 0.1958042 0.1958042 0.1888112 0.1888112 ... 0.6923077 0.6993007 0.6993006990.70629371 0.65034965 0.6433566430.55244755 0.03496503 0.0000000001
i.vector.340.02739726 0.2739726030.21917808 0.21232877 0.21232877 0.2123288 0.2054795 0.1986301 0.1986301 0.1986301 ... 0.8150685 0.8972603 0.8904109590.89041096 0.88356164 0.8493150680.30136986 0.00000000 0.0000000001
i.vector.350.02962963 0.2666666670.20000000 0.20740741 0.20000000 0.2000000 0.1925926 0.2000000 0.1925926 0.1851852 ... 0.9037037 0.9037037 0.9037037040.90370370 0.89629630 0.8888888890.60740741 0.00000000 0.0000000001
i.vector.360.02739726 0.2739726030.21917808 0.21232877 0.21232877 0.2054795 0.2054795 0.2054795 0.1986301 0.1986301 ... 0.7945205 0.8767123 0.8767123290.86986301 0.86986301 0.8424657530.23972603 0.00000000 0.0000000001
i.vector.370.02205882 0.2573529410.19852941 0.19852941 0.19852941 0.1911765 0.1911765 0.1911765 0.1838235 0.1838235 ... 0.8970588 0.8970588 0.8970588240.88970588 0.88235294 0.8823529410.75735294 0.02941176 0.0000000001
i.vector.380.02797203 0.2727272730.20979021 0.20979021 0.20979021 0.2027972 0.2027972 0.1958042 0.1958042 0.1958042 ... 0.7692308 0.8881119 0.8811188810.88111888 0.88111888 0.8741258740.46153846 0.00000000 0.0000000001
i.vector.390.02941176 0.2647058820.19852941 0.19852941 0.19852941 0.1985294 0.1911765 0.1911765 0.1911765 0.1911765 ... 0.8897059 0.8897059 0.8897058820.88235294 0.87500000 0.8676470590.75735294 0.03676471 0.0000000001
i.vector.400.02758621 0.2758620690.21379310 0.21379310 0.21379310 0.2068966 0.2068966 0.2000000 0.2000000 0.1931034 ... 0.7448276 0.8689655 0.8620689660.85517241 0.85517241 0.8344827590.30344828 0.00000000 0.0000000001
i.vector.410.02189781 0.2627737230.20437956 0.19708029 0.19708029 0.1970803 0.1897810 0.1897810 0.1824818 0.1824818 ... 0.8905109 0.8905109 0.8905109490.88321168 0.87591241 0.8686131390.58394161 0.00000000 0.0000000001
i.vector.420.28846154 0.2756410260.27564103 0.26923077 0.25641026 0.2500000 0.2435897 0.2371795 0.2307692 0.2243590 ... 0.1282051 0.1282051 0.0961538460.12179487 0.09615385 0.1923076920.30128205 0.29487179 0.3012820511
i.vector.430.30128205 0.3782051280.23076923 0.23717949 0.24358974 0.3141026 0.4358974 0.3846154 0.3333333 0.3141026 ... 0.2500000 0.2371795 0.1346153850.08974359 0.03205128 0.0064102560.00000000 0.00000000 0.0000000001
i.vector.440.25806452 0.2516129030.24516129 0.23870968 0.23225806 0.2193548 0.2129032 0.2064516 0.2000000 0.1935484 ... 0.2193548 0.3161290 0.3096774190.30967742 0.31612903 0.3161290320.26451613 0.27741935 0.0258064521
i.vector.450.12179487 0.0064102560.06410256 0.41666667 0.24358974 0.1730769 0.1858974 0.1794872 0.3782051 0.4294872 ... 0.4615385 0.3589744 0.6217948720.51282051 0.33333333 0.2692307690.06410256 0.03846154 0.0064102561
i.vector.460.10897436 0.0064102560.05128205 0.38461538 0.22435897 0.1538462 0.1666667 0.1666667 0.3525641 0.3910256 ... 0.7756410 0.6602564 0.4871794870.43589744 0.48076923 0.4807692310.44230769 0.41025641 0.5000000001
i.vector.470.12179487 0.0064102560.06410256 0.41666667 0.23717949 0.1666667 0.1858974 0.1794872 0.3782051 0.4166667 ... 0.3589744 0.5705128 0.5961538460.31410256 0.38461538 0.1538461540.05769231 0.02564103 0.0000000001
i.vector.480.20325203 0.1951219510.18699187 0.18699187 0.17886179 0.1788618 0.1707317 0.1626016 0.1626016 0.1544715 ... 0.9186992 0.6747967 0.0081300810.03252033 0.04065041 0.1382113820.21138211 0.21138211 0.2113821141
In [11]:
total.frame<-rbind(left.frame,right.frame)
total.frame
r1.c1r1.c2r1.c3r1.c4r1.c5r1.c6r1.c7r1.c8r1.c9r1.c10...r60.c56r60.c57r60.c58r60.c59r60.c60r60.c61r60.c62r60.c63r60.c64class1.label
image.vector0.10897436 0.0064102560.05128205 0.37179487 0.21794872 0.1538462 0.1666667 0.1602564 0.3461538 0.3846154 ... 0.5320513 0.6538462 0.3333333330.51282051 0.30769231 0.3910256 0.5256410 0.37820513 0.0448717950
i.vector0.20769231 0.2000000000.20000000 0.19230769 0.18461538 0.1769231 0.1692308 0.1692308 0.1615385 0.1538462 ... 0.8692308 0.5000000 0.0076923080.03076923 0.03846154 0.1461538 0.2230769 0.22307692 0.2153846150
i.vector.10.18852459 0.1803278690.17213115 0.16393443 0.16393443 0.1557377 0.1557377 0.1475410 0.1393443 0.1311475 ... 0.9016393 0.9016393 0.9016393440.90163934 0.70491803 0.1885246 0.2213115 0.21311475 0.2049180330
i.vector.20.20634921 0.1984126980.19841270 0.19047619 0.18253968 0.1746032 0.1746032 0.1666667 0.1587302 0.1587302 ... 0.9206349 0.6190476 0.0238095240.03174603 0.03968254 0.1428571 0.2222222 0.21428571 0.2142857140
i.vector.30.17500000 0.1750000000.16666667 0.16666667 0.15833333 0.1500000 0.1500000 0.1416667 0.1333333 0.1250000 ... 0.9166667 0.9166667 0.9166666670.91666667 0.80833333 0.4416667 0.2166667 0.21666667 0.2083333330
i.vector.40.20000000 0.1920000000.19200000 0.18400000 0.17600000 0.1680000 0.1680000 0.1600000 0.1520000 0.1440000 ... 0.8880000 0.5040000 0.0000000000.02400000 0.04000000 0.1360000 0.2160000 0.21600000 0.2080000000
i.vector.50.19834711 0.1900826450.18181818 0.17355372 0.17355372 0.1652893 0.1570248 0.1487603 0.1487603 0.1404959 ... 0.9090909 0.9173554 0.6859504130.03305785 0.04132231 0.1322314 0.2066116 0.20661157 0.1983471070
i.vector.60.19841270 0.1984126980.19047619 0.18253968 0.17460317 0.1746032 0.1666667 0.1587302 0.1587302 0.1507937 ... 0.8888889 0.5158730 0.0079365080.03174603 0.03968254 0.1428571 0.2222222 0.22222222 0.2222222220
i.vector.70.24161074 0.2281879190.22147651 0.21476510 0.21476510 0.2080537 0.2013423 0.2013423 0.1946309 0.1879195 ... 0.2617450 0.2684564 0.2684563760.26845638 0.26174497 0.2617450 0.2617450 0.25503356 0.2416107380
i.vector.80.21935484 0.2129032260.21290323 0.20645161 0.20000000 0.1935484 0.1870968 0.1806452 0.1806452 0.1741935 ... 0.2838710 0.2774194 0.2645161290.25161290 0.23870968 0.2258065 0.2129032 0.20645161 0.2000000000
i.vector.90.24324324 0.2297297300.22297297 0.21621622 0.20945946 0.2094595 0.2027027 0.2027027 0.1959459 0.1891892 ... 0.2567568 0.2635135 0.2635135140.26351351 0.26351351 0.2635135 0.2567568 0.25000000 0.2364864860
i.vector.100.00000000 0.0000000000.00000000 0.00000000 0.00000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 ... 0.3354430 0.3607595 0.3164556960.46835443 0.15822785 0.1075949 0.0443038 0.02531646 0.0000000000
i.vector.110.21935484 0.2129032260.20645161 0.20645161 0.20000000 0.1935484 0.1870968 0.1806452 0.1741935 0.1677419 ... 0.2838710 0.2774194 0.2645161290.25161290 0.23870968 0.2258065 0.2129032 0.20000000 0.2000000000
i.vector.120.22368421 0.2171052630.21710526 0.21052632 0.21052632 0.2039474 0.1973684 0.1907895 0.1842105 0.1842105 ... 0.2631579 0.2565789 0.2565789470.25657895 0.24342105 0.2368421 0.2236842 0.21052632 0.1973684210
i.vector.130.22580645 0.2258064520.21935484 0.21290323 0.20645161 0.2000000 0.2000000 0.1870968 0.1870968 0.1806452 ... 0.2838710 0.2774194 0.2645161290.25161290 0.23870968 0.2258065 0.2129032 0.20645161 0.1935483870
i.vector.140.24000000 0.2266666670.22000000 0.21333333 0.21333333 0.2066667 0.2066667 0.1933333 0.1933333 0.1866667 ... 0.2600000 0.2600000 0.2600000000.26666667 0.26666667 0.2600000 0.2600000 0.25333333 0.2400000000
i.vector.150.22580645 0.2193548390.21290323 0.21290323 0.20645161 0.2064516 0.2000000 0.1935484 0.1870968 0.1741935 ... 0.2838710 0.2774194 0.2645161290.25161290 0.23870968 0.2258065 0.2129032 0.20645161 0.1935483870
i.vector.160.20800000 0.2000000000.20000000 0.18400000 0.17600000 0.1760000 0.1680000 0.1600000 0.1520000 0.1440000 ... 0.9120000 0.9040000 0.8960000000.88000000 0.81600000 0.1760000 0.2160000 0.21600000 0.2160000000
i.vector.170.20800000 0.2000000000.19200000 0.18400000 0.18400000 0.1760000 0.1680000 0.1600000 0.1600000 0.1520000 ... 0.9040000 0.9120000 0.9040000000.92000000 0.46400000 0.1680000 0.2240000 0.21600000 0.2160000000
i.vector.180.20967742 0.2096774190.20161290 0.19354839 0.18548387 0.1854839 0.1693548 0.1693548 0.1612903 0.1532258 ... 0.9112903 0.9112903 0.8951612900.89516129 0.89516129 0.2580645 0.2177419 0.20967742 0.2096774190
i.vector.190.20800000 0.2000000000.19200000 0.19200000 0.18400000 0.1760000 0.1680000 0.1680000 0.1600000 0.1520000 ... 0.9120000 0.9040000 0.9040000000.91200000 0.54400000 0.1600000 0.2240000 0.21600000 0.2160000000
i.vector.200.20967742 0.1935483870.19354839 0.17741935 0.16935484 0.1693548 0.1693548 0.1612903 0.1451613 0.1451613 ... 0.9112903 0.9112903 0.9112903230.89516129 0.91129032 0.3629032 0.2258065 0.21774194 0.2177419350
i.vector.210.10897436 0.0000000000.05128205 0.38461538 0.22435897 0.1538462 0.1730769 0.1666667 0.3525641 0.3974359 ... 0.7307692 0.5128205 0.2820512820.30769231 0.35897436 0.4102564 0.2051282 0.03205128 0.0064102560
i.vector.220.20800000 0.2080000000.20000000 0.19200000 0.18400000 0.1760000 0.1760000 0.1680000 0.1600000 0.1520000 ... 0.9040000 0.8960000 0.9040000000.90400000 0.49600000 0.1680000 0.2160000 0.20800000 0.2080000000
i.vector.230.20161290 0.1935483870.18548387 0.17741935 0.17741935 0.1693548 0.1612903 0.1612903 0.1532258 0.1451613 ... 0.9112903 0.9112903 0.9112903230.88709677 0.90322581 0.4354839 0.2177419 0.21774194 0.2096774190
i.vector.240.20634921 0.1984126980.19841270 0.19047619 0.18253968 0.1746032 0.1666667 0.1587302 0.1507937 0.1507937 ... 0.8809524 0.9047619 0.8809523810.89682540 0.61111111 0.1587302 0.2142857 0.20634921 0.2063492060
i.vector.250.21428571 0.2936507940.24603175 0.23809524 0.23809524 0.2301587 0.2301587 0.2222222 0.2222222 0.2142857 ... 0.8412698 0.8333333 0.7857142860.36507937 0.00000000 0.0000000 0.0000000 0.00000000 0.0000000000
i.vector.260.08029197 0.0802919710.08029197 0.08029197 0.09489051 0.1824818 0.2189781 0.2116788 0.2116788 0.2043796 ... 0.7372263 0.7518248 0.7518248180.75182482 0.72262774 0.6423358 0.1532847 0.00000000 0.0000000000
i.vector.270.20634921 0.2857142860.23809524 0.23809524 0.23015873 0.2301587 0.2222222 0.2222222 0.2142857 0.2063492 ... 0.8412698 0.8412698 0.7857142860.35714286 0.00000000 0.0000000 0.0000000 0.00000000 0.0000000000
i.vector.280.08759124 0.0875912410.08759124 0.08759124 0.10218978 0.1897810 0.2189781 0.2116788 0.2116788 0.2116788 ... 0.7299270 0.7372263 0.7445255470.74452555 0.71532847 0.6277372 0.1532847 0.00000000 0.0000000000
................................. ..............................
i.vector.1910.20491803 0.2049180330.19672131 0.18852459 0.18032787 0.1721311 0.1639344 0.1639344 0.1557377 0.1475410 ... 0.9098361 0.9098361 0.9098360660.90163934 0.90163934 0.6639344260.20491803 0.20491803 0.2049180331
i.vector.2010.20491803 0.1967213110.18852459 0.18032787 0.18032787 0.1721311 0.1721311 0.1639344 0.1557377 0.1475410 ... 0.9098361 0.9098361 0.9098360660.90163934 0.90163934 0.5491803280.21311475 0.20491803 0.2049180331
i.vector.2110.10828025 0.0063694270.05732484 0.38853503 0.22292994 0.1592357 0.1719745 0.1656051 0.3566879 0.3949045 ... 0.5796178 0.7197452 0.7261146500.37579618 0.43949045 0.3375796180.42675159 0.45859873 0.2484076431
i.vector.2210.20325203 0.1951219510.18699187 0.17886179 0.17073171 0.1707317 0.1626016 0.1544715 0.1463415 0.1463415 ... 0.9105691 0.9105691 0.9024390240.90243902 0.91056911 0.6260162600.21951220 0.21951220 0.2113821141
i.vector.2310.20491803 0.1967213110.18852459 0.17213115 0.17213115 0.1639344 0.1639344 0.1557377 0.1475410 0.1393443 ... 0.9098361 0.9098361 0.9098360660.89344262 0.90163934 0.6147540980.21311475 0.21311475 0.2049180331
i.vector.2410.20325203 0.1951219510.19512195 0.18699187 0.17886179 0.1707317 0.1707317 0.1544715 0.1544715 0.1463415 ... 0.9024390 0.9105691 0.9105691060.90243902 0.90243902 0.3902439020.21951220 0.21138211 0.2032520331
i.vector.2510.21052632 0.2781954890.23308271 0.23308271 0.22556391 0.2255639 0.2255639 0.2180451 0.2180451 0.2105263 ... 0.7669173 0.7593985 0.6992481200.20300752 0.00000000 0.0000000000.00000000 0.00000000 0.0000000001
i.vector.2610.07746479 0.0704225350.07042254 0.07746479 0.09154930 0.1690141 0.1971831 0.1971831 0.1901408 0.1901408 ... 0.6971831 0.7042254 0.7042253520.71126761 0.65492958 0.6408450700.57042254 0.04225352 0.0000000001
i.vector.2710.20300752 0.2781954890.22556391 0.22556391 0.22556391 0.2180451 0.2180451 0.2105263 0.2105263 0.2030075 ... 0.7669173 0.7518797 0.7067669170.25563910 0.00000000 0.0000000000.00000000 0.00000000 0.0000000001
i.vector.2810.07801418 0.0709219860.07092199 0.07801418 0.09219858 0.1702128 0.1985816 0.1985816 0.1985816 0.1914894 ... 0.7021277 0.7021277 0.7092198580.70921986 0.65248227 0.6453900710.53900709 0.02836879 0.0000000001
i.vector.2910.21804511 0.2932330830.24060150 0.24060150 0.24060150 0.2330827 0.2330827 0.2255639 0.2180451 0.2180451 ... 0.7669173 0.7593985 0.7067669170.22556391 0.00000000 0.0000000000.00000000 0.00000000 0.0000000001
i.vector.3010.07042254 0.0774647890.07042254 0.07746479 0.09154930 0.1690141 0.2042254 0.1971831 0.1901408 0.1901408 ... 0.6971831 0.6971831 0.7112676060.70422535 0.64788732 0.6478873240.52816901 0.02112676 0.0000000001
i.vector.3110.21052632 0.2857142860.24060150 0.24060150 0.23308271 0.2255639 0.2255639 0.2255639 0.2180451 0.2105263 ... 0.7669173 0.7593985 0.7067669170.19548872 0.00000000 0.0000000000.00000000 0.00000000 0.0000000001
i.vector.3210.12101911 0.0063694270.06369427 0.41401274 0.23566879 0.1656051 0.1847134 0.1783439 0.3694268 0.4203822 ... 0.3630573 0.6050955 0.6433121020.33757962 0.37579618 0.2675159240.06369427 0.03821656 0.0000000001
i.vector.3310.06993007 0.0699300700.06993007 0.07692308 0.08391608 0.1608392 0.1958042 0.1958042 0.1888112 0.1888112 ... 0.6923077 0.6993007 0.6993006990.70629371 0.65034965 0.6433566430.55244755 0.03496503 0.0000000001
i.vector.3410.02739726 0.2739726030.21917808 0.21232877 0.21232877 0.2123288 0.2054795 0.1986301 0.1986301 0.1986301 ... 0.8150685 0.8972603 0.8904109590.89041096 0.88356164 0.8493150680.30136986 0.00000000 0.0000000001
i.vector.3510.02962963 0.2666666670.20000000 0.20740741 0.20000000 0.2000000 0.1925926 0.2000000 0.1925926 0.1851852 ... 0.9037037 0.9037037 0.9037037040.90370370 0.89629630 0.8888888890.60740741 0.00000000 0.0000000001
i.vector.3610.02739726 0.2739726030.21917808 0.21232877 0.21232877 0.2054795 0.2054795 0.2054795 0.1986301 0.1986301 ... 0.7945205 0.8767123 0.8767123290.86986301 0.86986301 0.8424657530.23972603 0.00000000 0.0000000001
i.vector.3710.02205882 0.2573529410.19852941 0.19852941 0.19852941 0.1911765 0.1911765 0.1911765 0.1838235 0.1838235 ... 0.8970588 0.8970588 0.8970588240.88970588 0.88235294 0.8823529410.75735294 0.02941176 0.0000000001
i.vector.3810.02797203 0.2727272730.20979021 0.20979021 0.20979021 0.2027972 0.2027972 0.1958042 0.1958042 0.1958042 ... 0.7692308 0.8881119 0.8811188810.88111888 0.88111888 0.8741258740.46153846 0.00000000 0.0000000001
i.vector.3910.02941176 0.2647058820.19852941 0.19852941 0.19852941 0.1985294 0.1911765 0.1911765 0.1911765 0.1911765 ... 0.8897059 0.8897059 0.8897058820.88235294 0.87500000 0.8676470590.75735294 0.03676471 0.0000000001
i.vector.4010.02758621 0.2758620690.21379310 0.21379310 0.21379310 0.2068966 0.2068966 0.2000000 0.2000000 0.1931034 ... 0.7448276 0.8689655 0.8620689660.85517241 0.85517241 0.8344827590.30344828 0.00000000 0.0000000001
i.vector.4110.02189781 0.2627737230.20437956 0.19708029 0.19708029 0.1970803 0.1897810 0.1897810 0.1824818 0.1824818 ... 0.8905109 0.8905109 0.8905109490.88321168 0.87591241 0.8686131390.58394161 0.00000000 0.0000000001
i.vector.4210.28846154 0.2756410260.27564103 0.26923077 0.25641026 0.2500000 0.2435897 0.2371795 0.2307692 0.2243590 ... 0.1282051 0.1282051 0.0961538460.12179487 0.09615385 0.1923076920.30128205 0.29487179 0.3012820511
i.vector.4310.30128205 0.3782051280.23076923 0.23717949 0.24358974 0.3141026 0.4358974 0.3846154 0.3333333 0.3141026 ... 0.2500000 0.2371795 0.1346153850.08974359 0.03205128 0.0064102560.00000000 0.00000000 0.0000000001
i.vector.4410.25806452 0.2516129030.24516129 0.23870968 0.23225806 0.2193548 0.2129032 0.2064516 0.2000000 0.1935484 ... 0.2193548 0.3161290 0.3096774190.30967742 0.31612903 0.3161290320.26451613 0.27741935 0.0258064521
i.vector.4510.12179487 0.0064102560.06410256 0.41666667 0.24358974 0.1730769 0.1858974 0.1794872 0.3782051 0.4294872 ... 0.4615385 0.3589744 0.6217948720.51282051 0.33333333 0.2692307690.06410256 0.03846154 0.0064102561
i.vector.4610.10897436 0.0064102560.05128205 0.38461538 0.22435897 0.1538462 0.1666667 0.1666667 0.3525641 0.3910256 ... 0.7756410 0.6602564 0.4871794870.43589744 0.48076923 0.4807692310.44230769 0.41025641 0.5000000001
i.vector.4710.12179487 0.0064102560.06410256 0.41666667 0.23717949 0.1666667 0.1858974 0.1794872 0.3782051 0.4166667 ... 0.3589744 0.5705128 0.5961538460.31410256 0.38461538 0.1538461540.05769231 0.02564103 0.0000000001
i.vector.4810.20325203 0.1951219510.18699187 0.18699187 0.17886179 0.1788618 0.1707317 0.1626016 0.1626016 0.1544715 ... 0.9186992 0.6747967 0.0081300810.03252033 0.04065041 0.1382113820.21138211 0.21138211 0.2113821141

Next we create the training and test sets:

In [12]:
train.index<-sample(nrow(total.frame),nrow(total.frame)*0.8)
training.set<-total.frame[train.index,]
training.set
r1.c1r1.c2r1.c3r1.c4r1.c5r1.c6r1.c7r1.c8r1.c9r1.c10...r60.c56r60.c57r60.c58r60.c59r60.c60r60.c61r60.c62r60.c63r60.c64class1.label
i.vector.50.19834711 0.1900826450.18181818 0.17355372 0.17355372 0.1652893 0.1570248 0.1487603 0.1487603 0.1404959 ... 0.9090909 0.9173554 0.6859504130.03305785 0.04132231 0.1322314 0.20661157 0.20661157 0.19834711 0
i.vector.120.22368421 0.2171052630.21710526 0.21052632 0.21052632 0.2039474 0.1973684 0.1907895 0.1842105 0.1842105 ... 0.2631579 0.2565789 0.2565789470.25657895 0.24342105 0.2368421 0.22368421 0.21052632 0.19736842 0
i.vector.4710.12179487 0.0064102560.06410256 0.41666667 0.23717949 0.1666667 0.1858974 0.1794872 0.3782051 0.4166667 ... 0.3589744 0.5705128 0.5961538460.31410256 0.38461538 0.1538462 0.05769231 0.02564103 0.00000000 1
i.vector.180.20967742 0.2096774190.20161290 0.19354839 0.18548387 0.1854839 0.1693548 0.1693548 0.1612903 0.1532258 ... 0.9112903 0.9112903 0.8951612900.89516129 0.89516129 0.2580645 0.21774194 0.20967742 0.20967742 0
i.vector.470.11538462 0.0064102560.05769231 0.40384615 0.23076923 0.1602564 0.1794872 0.1730769 0.3653846 0.4102564 ... 0.5512821 0.6217949 0.3205128210.35897436 0.17948718 0.1153846 0.05769231 0.02564103 0.00000000 0
i.vector.2910.21804511 0.2932330830.24060150 0.24060150 0.24060150 0.2330827 0.2330827 0.2255639 0.2180451 0.2180451 ... 0.7669173 0.7593985 0.7067669170.22556391 0.00000000 0.0000000 0.00000000 0.00000000 0.00000000 1
i.vector.410.02205882 0.2573529410.19117647 0.19117647 0.19117647 0.1911765 0.1838235 0.1838235 0.1838235 0.1764706 ... 0.8897059 0.8897059 0.8897058820.88235294 0.85294118 0.7647059 0.07352941 0.00000000 0.00000000 0
i.vector.3710.02205882 0.2573529410.19852941 0.19852941 0.19852941 0.1911765 0.1911765 0.1911765 0.1838235 0.1838235 ... 0.8970588 0.8970588 0.8970588240.88970588 0.88235294 0.8823529 0.75735294 0.02941176 0.00000000 1
i.vector.10.18852459 0.1803278690.17213115 0.16393443 0.16393443 0.1557377 0.1557377 0.1475410 0.1393443 0.1311475 ... 0.9016393 0.9016393 0.9016393440.90163934 0.70491803 0.1885246 0.22131148 0.21311475 0.20491803 0
i.vector.160.20800000 0.2000000000.20000000 0.18400000 0.17600000 0.1760000 0.1680000 0.1600000 0.1520000 0.1440000 ... 0.9120000 0.9040000 0.8960000000.88000000 0.81600000 0.1760000 0.21600000 0.21600000 0.21600000 0
i.vector.2810.07801418 0.0709219860.07092199 0.07801418 0.09219858 0.1702128 0.1985816 0.1985816 0.1985816 0.1914894 ... 0.7021277 0.7021277 0.7092198580.70921986 0.65248227 0.6453901 0.53900709 0.02836879 0.00000000 1
i.vector.2210.20325203 0.1951219510.18699187 0.17886179 0.17073171 0.1707317 0.1626016 0.1544715 0.1463415 0.1463415 ... 0.9105691 0.9105691 0.9024390240.90243902 0.91056911 0.6260163 0.21951220 0.21951220 0.21138211 1
i.vector.340.02816901 0.2605633800.20422535 0.20422535 0.19718310 0.1971831 0.1901408 0.1901408 0.1901408 0.1830986 ... 0.8521127 0.8450704 0.8450704230.82394366 0.80281690 0.2253521 0.00000000 0.00000000 0.00000000 0
i.vector10.22047244 0.2125984250.20472441 0.18897638 0.18110236 0.1811024 0.1732283 0.1732283 0.1653543 0.1653543 ... 0.9212598 0.8031496 0.4094488190.03149606 0.03937008 0.1338583 0.21259843 0.22047244 0.21259843 1
i.vector.480.19512195 0.1951219510.18699187 0.17886179 0.17073171 0.1707317 0.1626016 0.1626016 0.1463415 0.1463415 ... 0.9105691 0.2926829 0.0081300810.03252033 0.04065041 0.1382114 0.21951220 0.21138211 0.21138211 0
i.vector.4010.02758621 0.2758620690.21379310 0.21379310 0.21379310 0.2068966 0.2068966 0.2000000 0.2000000 0.1931034 ... 0.7448276 0.8689655 0.8620689660.85517241 0.85517241 0.8344828 0.30344828 0.00000000 0.00000000 1
i.vector.190.20800000 0.2000000000.19200000 0.19200000 0.18400000 0.1760000 0.1680000 0.1680000 0.1600000 0.1520000 ... 0.9120000 0.9040000 0.9040000000.91200000 0.54400000 0.1600000 0.22400000 0.21600000 0.21600000 0
i.vector.610.20161290 0.1935483870.19354839 0.18548387 0.17741935 0.1693548 0.1612903 0.1612903 0.1532258 0.1532258 ... 0.9274194 0.7500000 0.1129032260.03225806 0.04032258 0.1451613 0.22580645 0.21774194 0.21774194 1
i.vector.270.20634921 0.2857142860.23809524 0.23809524 0.23015873 0.2301587 0.2222222 0.2222222 0.2142857 0.2063492 ... 0.8412698 0.8412698 0.7857142860.35714286 0.00000000 0.0000000 0.00000000 0.00000000 0.00000000 0
i.vector.3010.07042254 0.0774647890.07042254 0.07746479 0.09154930 0.1690141 0.2042254 0.1971831 0.1901408 0.1901408 ... 0.6971831 0.6971831 0.7112676060.70422535 0.64788732 0.6478873 0.52816901 0.02112676 0.00000000 1
i.vector.4410.25806452 0.2516129030.24516129 0.23870968 0.23225806 0.2193548 0.2129032 0.2064516 0.2000000 0.1935484 ... 0.2193548 0.3161290 0.3096774190.30967742 0.31612903 0.3161290 0.26451613 0.27741935 0.02580645 1
i.vector.300.07407407 0.0740740740.07407407 0.08148148 0.08888889 0.1851852 0.2148148 0.2148148 0.2074074 0.2000000 ... 0.7555556 0.7555556 0.7629629630.75555556 0.72592593 0.6296296 0.11851852 0.00000000 0.00000000 0
i.vector.2410.20325203 0.1951219510.19512195 0.18699187 0.17886179 0.1707317 0.1707317 0.1544715 0.1544715 0.1463415 ... 0.9024390 0.9105691 0.9105691060.90243902 0.90243902 0.3902439 0.21951220 0.21138211 0.20325203 1
i.vector.110.21935484 0.2129032260.20645161 0.20645161 0.20000000 0.1935484 0.1870968 0.1806452 0.1741935 0.1677419 ... 0.2838710 0.2774194 0.2645161290.25161290 0.23870968 0.2258065 0.21290323 0.20000000 0.20000000 0
i.vector.370.02222222 0.2592592590.20000000 0.20000000 0.19259259 0.1925926 0.1925926 0.1925926 0.1851852 0.1851852 ... 0.9037037 0.9037037 0.8962962960.89629630 0.88888889 0.8222222 0.13333333 0.00000000 0.00000000 0
i.vector.910.22666667 0.2200000000.21333333 0.20666667 0.20666667 0.2000000 0.1933333 0.1933333 0.1866667 0.1800000 ... 0.2933333 0.2266667 0.1600000000.32000000 0.32000000 0.3200000 0.32000000 0.32000000 0.32000000 1
i.vector.250.21428571 0.2936507940.24603175 0.23809524 0.23809524 0.2301587 0.2301587 0.2222222 0.2222222 0.2142857 ... 0.8412698 0.8333333 0.7857142860.36507937 0.00000000 0.0000000 0.00000000 0.00000000 0.00000000 0
i.vector.1610.20325203 0.1951219510.18699187 0.17886179 0.17073171 0.1707317 0.1626016 0.1544715 0.1544715 0.1463415 ... 0.9105691 0.9105691 0.9105691060.89430894 0.90243902 0.8455285 0.22764228 0.21138211 0.21138211 1
i.vector.1710.20325203 0.2032520330.19512195 0.18699187 0.17886179 0.1788618 0.1707317 0.1626016 0.1544715 0.1463415 ... 0.9105691 0.9024390 0.9105691060.90243902 0.91056911 0.5934959 0.21951220 0.21951220 0.21138211 1
i.vector.90.24324324 0.2297297300.22297297 0.21621622 0.20945946 0.2094595 0.2027027 0.2027027 0.1959459 0.1891892 ... 0.2567568 0.2635135 0.2635135140.26351351 0.26351351 0.2635135 0.25675676 0.25000000 0.23648649 0
................................. ..............................
i.vector.200.20967742 0.1935483870.19354839 0.17741935 0.16935484 0.1693548 0.1693548 0.1612903 0.1451613 0.1451613 ... 0.9112903 0.9112903 0.91129032 0.89516129 0.91129032 0.3629032 0.22580645 0.21774194 0.21774194 0
i.vector.380.02898551 0.2681159420.20289855 0.21014493 0.20289855 0.2028986 0.1956522 0.1956522 0.1956522 0.1884058 ... 0.8985507 0.8913043 0.89130435 0.89130435 0.88405797 0.7608696 0.02173913 0.00000000 0.00000000 0
i.vector.3910.02941176 0.2647058820.19852941 0.19852941 0.19852941 0.1985294 0.1911765 0.1911765 0.1911765 0.1911765 ... 0.8897059 0.8897059 0.88970588 0.88235294 0.87500000 0.8676471 0.75735294 0.03676471 0.00000000 1
i.vector.350.02962963 0.2592592590.20000000 0.20000000 0.19259259 0.1925926 0.1925926 0.1851852 0.1851852 0.1777778 ... 0.8962963 0.8888889 0.89629630 0.88888889 0.85925926 0.7851852 0.08888889 0.00000000 0.00000000 0
i.vector.1810.20491803 0.1967213110.18852459 0.18852459 0.18032787 0.1721311 0.1639344 0.1557377 0.1557377 0.1475410 ... 0.9098361 0.9098361 0.90983607 0.90163934 0.90983607 0.5245902 0.21311475 0.21311475 0.20491803 1
i.vector.710.23026316 0.2302631580.22368421 0.21710526 0.21052632 0.2039474 0.2039474 0.1973684 0.1842105 0.1776316 ... 0.2434211 0.2105263 0.18421053 0.35526316 0.31578947 0.3223684 0.32236842 0.32236842 0.31578947 1
i.vector.510.19166667 0.1916666670.18333333 0.18333333 0.17500000 0.1750000 0.1666667 0.1583333 0.1500000 0.1500000 ... 0.9166667 0.9166667 0.60833333 0.03333333 0.04166667 0.1333333 0.20833333 0.20833333 0.20000000 1
i.vector.390.02222222 0.2592592590.20000000 0.19259259 0.19259259 0.1851852 0.1851852 0.1851852 0.1851852 0.1777778 ... 0.8888889 0.8888889 0.88148148 0.88148148 0.88148148 0.8370370 0.32592593 0.00000000 0.00000000 0
i.vector.290.21428571 0.2936507940.24603175 0.23809524 0.23809524 0.2380952 0.2301587 0.2222222 0.2222222 0.2222222 ... 0.8492063 0.8412698 0.79365079 0.37301587 0.00000000 0.0000000 0.00000000 0.00000000 0.00000000 0
i.vector.360.02816901 0.2676056340.21126761 0.21126761 0.20422535 0.1971831 0.2042254 0.1971831 0.1971831 0.1901408 ... 0.8943662 0.8873239 0.88028169 0.88028169 0.87323944 0.4647887 0.00000000 0.00000000 0.00000000 0
i.vector.230.20161290 0.1935483870.18548387 0.17741935 0.17741935 0.1693548 0.1612903 0.1612903 0.1532258 0.1451613 ... 0.9112903 0.9112903 0.91129032 0.88709677 0.90322581 0.4354839 0.21774194 0.21774194 0.20967742 0
i.vector.810.23566879 0.2229299360.22292994 0.21656051 0.21019108 0.2038217 0.2038217 0.1974522 0.1910828 0.1847134 ... 0.2993631 0.2675159 0.36942675 0.23566879 0.31847134 0.3184713 0.31210191 0.31210191 0.30573248 1
i.vector.2100.20161290 0.2016129030.19354839 0.19354839 0.18548387 0.1774194 0.1693548 0.1612903 0.1612903 0.1532258 ... 0.9274194 0.7500000 0.09677419 0.03225806 0.04032258 0.1451613 0.21774194 0.21774194 0.21774194 1
i.vector.150.22580645 0.2193548390.21290323 0.21290323 0.20645161 0.2064516 0.2000000 0.1935484 0.1870968 0.1741935 ... 0.2838710 0.2774194 0.26451613 0.25161290 0.23870968 0.2258065 0.21290323 0.20645161 0.19354839 0
i.vector.3310.06993007 0.0699300700.06993007 0.07692308 0.08391608 0.1608392 0.1958042 0.1958042 0.1888112 0.1888112 ... 0.6923077 0.6993007 0.69930070 0.70629371 0.65034965 0.6433566 0.55244755 0.03496503 0.00000000 1
i.vector.140.24000000 0.2266666670.22000000 0.21333333 0.21333333 0.2066667 0.2066667 0.1933333 0.1933333 0.1866667 ... 0.2600000 0.2600000 0.26000000 0.26666667 0.26666667 0.2600000 0.26000000 0.25333333 0.24000000 0
i.vector.1010.12101911 0.0063694270.06369427 0.40764331 0.23566879 0.1656051 0.1847134 0.1783439 0.3757962 0.4140127 ... 0.3757962 0.6242038 0.62420382 0.33121019 0.39490446 0.2611465 0.05732484 0.03184713 0.00000000 1
image.vector0.10897436 0.0064102560.05128205 0.37179487 0.21794872 0.1538462 0.1666667 0.1602564 0.3461538 0.3846154 ... 0.5320513 0.6538462 0.33333333 0.51282051 0.30769231 0.3910256 0.52564103 0.37820513 0.04487179 0
i.vector.2510.21052632 0.2781954890.23308271 0.23308271 0.22556391 0.2255639 0.2255639 0.2180451 0.2180451 0.2105263 ... 0.7669173 0.7593985 0.69924812 0.20300752 0.00000000 0.0000000 0.00000000 0.00000000 0.00000000 1
i.vector.2010.20491803 0.1967213110.18852459 0.18032787 0.18032787 0.1721311 0.1721311 0.1639344 0.1557377 0.1475410 ... 0.9098361 0.9098361 0.90983607 0.90163934 0.90163934 0.5491803 0.21311475 0.20491803 0.20491803 1
i.vector.3110.21052632 0.2857142860.24060150 0.24060150 0.23308271 0.2255639 0.2255639 0.2255639 0.2180451 0.2105263 ... 0.7669173 0.7593985 0.70676692 0.19548872 0.00000000 0.0000000 0.00000000 0.00000000 0.00000000 1
i.vector.100.00000000 0.0000000000.00000000 0.00000000 0.00000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 ... 0.3354430 0.3607595 0.31645570 0.46835443 0.15822785 0.1075949 0.04430380 0.02531646 0.00000000 0
i.vector.30.17500000 0.1750000000.16666667 0.16666667 0.15833333 0.1500000 0.1500000 0.1416667 0.1333333 0.1250000 ... 0.9166667 0.9166667 0.91666667 0.91666667 0.80833333 0.4416667 0.21666667 0.21666667 0.20833333 0
i.vector.3100.19327731 0.1848739500.18487395 0.17647059 0.16806723 0.1596639 0.1512605 0.1512605 0.1428571 0.1428571 ... 0.9243697 0.9243697 0.91596639 0.91596639 0.82352941 0.5210084 0.21848739 0.21848739 0.21008403 1
i.vector.1510.23076923 0.2243589740.21794872 0.21153846 0.21153846 0.2051282 0.2051282 0.1923077 0.1858974 0.1858974 ... 0.3076923 0.3076923 0.35256410 0.24358974 0.31410256 0.3141026 0.31410256 0.31410256 0.30128205 1
i.vector.1910.20491803 0.2049180330.19672131 0.18852459 0.18032787 0.1721311 0.1639344 0.1639344 0.1557377 0.1475410 ... 0.9098361 0.9098361 0.90983607 0.90163934 0.90163934 0.6639344 0.20491803 0.20491803 0.20491803 1
i.vector.40.20000000 0.1920000000.19200000 0.18400000 0.17600000 0.1680000 0.1680000 0.1600000 0.1520000 0.1440000 ... 0.8880000 0.5040000 0.00000000 0.02400000 0.04000000 0.1360000 0.21600000 0.21600000 0.20800000 0
i.vector.20.20634921 0.1984126980.19841270 0.19047619 0.18253968 0.1746032 0.1746032 0.1666667 0.1587302 0.1587302 ... 0.9206349 0.6190476 0.02380952 0.03174603 0.03968254 0.1428571 0.22222222 0.21428571 0.21428571 0
i.vector.1100.19166667 0.1833333330.17500000 0.17500000 0.16666667 0.1583333 0.1583333 0.1500000 0.1416667 0.1416667 ... 0.9166667 0.9166667 0.91666667 0.91666667 0.81666667 0.4166667 0.21666667 0.21666667 0.20833333 1
i.vector.130.22580645 0.2258064520.21935484 0.21290323 0.20645161 0.2000000 0.2000000 0.1870968 0.1870968 0.1806452 ... 0.2838710 0.2774194 0.26451613 0.25161290 0.23870968 0.2258065 0.21290323 0.20645161 0.19354839 0
In [13]:
test.set<-total.frame[-train.index,]
test.set
r1.c1r1.c2r1.c3r1.c4r1.c5r1.c6r1.c7r1.c8r1.c9r1.c10...r60.c56r60.c57r60.c58r60.c59r60.c60r60.c61r60.c62r60.c63r60.c64class1.label
i.vector0.20769231 0.2000000000.20000000 0.19230769 0.1846154 0.1769231 0.1692308 0.1692308 0.1615385 0.1538462 ... 0.8692308 0.50000000 0.0076923080.03076923 0.03846154 0.1461538460.22307692 0.22307692 0.2153846150
i.vector.60.19841270 0.1984126980.19047619 0.18253968 0.1746032 0.1746032 0.1666667 0.1587302 0.1587302 0.1507937 ... 0.8888889 0.51587302 0.0079365080.03174603 0.03968254 0.1428571430.22222222 0.22222222 0.2222222220
i.vector.70.24161074 0.2281879190.22147651 0.21476510 0.2147651 0.2080537 0.2013423 0.2013423 0.1946309 0.1879195 ... 0.2617450 0.26845638 0.2684563760.26845638 0.26174497 0.2617449660.26174497 0.25503356 0.2416107380
i.vector.80.21935484 0.2129032260.21290323 0.20645161 0.2000000 0.1935484 0.1870968 0.1806452 0.1806452 0.1741935 ... 0.2838710 0.27741935 0.2645161290.25161290 0.23870968 0.2258064520.21290323 0.20645161 0.2000000000
i.vector.210.10897436 0.0000000000.05128205 0.38461538 0.2243590 0.1538462 0.1730769 0.1666667 0.3525641 0.3974359 ... 0.7307692 0.51282051 0.2820512820.30769231 0.35897436 0.4102564100.20512821 0.03205128 0.0064102560
i.vector.280.08759124 0.0875912410.08759124 0.08759124 0.1021898 0.1897810 0.2189781 0.2116788 0.2116788 0.2116788 ... 0.7299270 0.73722628 0.7445255470.74452555 0.71532847 0.6277372260.15328467 0.00000000 0.0000000000
i.vector.310.21600000 0.2960000000.24800000 0.24800000 0.2400000 0.2400000 0.2400000 0.2320000 0.2320000 0.2240000 ... 0.8640000 0.84800000 0.8080000000.44800000 0.00000000 0.0000000000.00000000 0.00000000 0.0000000000
i.vector.400.02777778 0.2638888890.20833333 0.20833333 0.2013889 0.2013889 0.2013889 0.1944444 0.1944444 0.1875000 ... 0.8958333 0.88888889 0.8888888890.88194444 0.83333333 0.1736111110.00000000 0.00000000 0.0000000000
i.vector.430.28846154 0.3653846150.21794872 0.23076923 0.2371795 0.3012821 0.4230769 0.3717949 0.3205128 0.3012821 ... 0.1666667 0.07692308 0.1282051280.07692308 0.02564103 0.0064102560.00000000 0.00000000 0.0000000000
i.vector.450.11464968 0.0063694270.07006369 0.40764331 0.2356688 0.1656051 0.1847134 0.1783439 0.3757962 0.4140127 ... 0.3439490 0.51592357 0.5350318470.30573248 0.29299363 0.1146496820.05732484 0.03184713 0.0000000000
i.vector.460.10191083 0.0063694270.05095541 0.37579618 0.2165605 0.1528662 0.1656051 0.1656051 0.3439490 0.3885350 ... 0.4840764 0.51592357 0.3503184710.42038217 0.21656051 0.4840764330.50318471 0.05095541 0.0000000000
image.vector10.11612903 0.0064516130.05806452 0.40000000 0.2322581 0.1612903 0.1806452 0.1741935 0.3677419 0.4129032 ... 0.6645161 0.70967742 0.3806451610.26451613 0.49032258 0.4193548390.53548387 0.55483871 0.3741935481
i.vector.1210.23178808 0.2251655630.22516556 0.21854305 0.2119205 0.2052980 0.1986755 0.1920530 0.1920530 0.1854305 ... 0.2516556 0.21192053 0.1721854300.35761589 0.31125828 0.3178807950.31788079 0.31788079 0.3178807951
i.vector.1410.22516556 0.2185430460.21192053 0.21192053 0.2052980 0.1986755 0.1920530 0.1854305 0.1788079 0.1721854 ... 0.3178808 0.21854305 0.1655629140.28476821 0.31788079 0.3178807950.31788079 0.31788079 0.3178807951
i.vector.2310.20491803 0.1967213110.18852459 0.17213115 0.1721311 0.1639344 0.1639344 0.1557377 0.1475410 0.1393443 ... 0.9098361 0.90983607 0.9098360660.89344262 0.90163934 0.6147540980.21311475 0.21311475 0.2049180331
i.vector.3410.02739726 0.2739726030.21917808 0.21232877 0.2123288 0.2123288 0.2054795 0.1986301 0.1986301 0.1986301 ... 0.8150685 0.89726027 0.8904109590.89041096 0.88356164 0.8493150680.30136986 0.00000000 0.0000000001
i.vector.3510.02962963 0.2666666670.20000000 0.20740741 0.2000000 0.2000000 0.1925926 0.2000000 0.1925926 0.1851852 ... 0.9037037 0.90370370 0.9037037040.90370370 0.89629630 0.8888888890.60740741 0.00000000 0.0000000001
i.vector.4210.28846154 0.2756410260.27564103 0.26923077 0.2564103 0.2500000 0.2435897 0.2371795 0.2307692 0.2243590 ... 0.1282051 0.12820513 0.0961538460.12179487 0.09615385 0.1923076920.30128205 0.29487179 0.3012820511
i.vector.4310.30128205 0.3782051280.23076923 0.23717949 0.2435897 0.3141026 0.4358974 0.3846154 0.3333333 0.3141026 ... 0.2500000 0.23717949 0.1346153850.08974359 0.03205128 0.0064102560.00000000 0.00000000 0.0000000001
i.vector.4810.20325203 0.1951219510.18699187 0.18699187 0.1788618 0.1788618 0.1707317 0.1626016 0.1626016 0.1544715 ... 0.9186992 0.67479675 0.0081300810.03252033 0.04065041 0.1382113820.21138211 0.21138211 0.2113821141

Next we train the classifiers, varying the number of hidden nodes:

In [14]:
library(neuralnet)
myform <- as.formula(paste('class1.label ~ ',paste(names(training.set[!names(training.set) %in% 'class1.label']), collapse = ' + ')))
face.classifier.3 <- neuralnet(myform, training.set, hidden = 3, rep=100, linear.output = FALSE, threshold = 0.1)
summary(face.classifier.3)
                    Length  Class      Mode    
call                      7 -none-     call    
response                 80 -none-     numeric 
covariate            307200 -none-     numeric 
model.list                2 -none-     list    
err.fct                   1 -none-     function
act.fct                   1 -none-     function
linear.output             1 -none-     logical 
data                   3841 data.frame list    
exclude                   0 -none-     NULL    
net.result              100 -none-     list    
weights                 100 -none-     list    
generalized.weights     100 -none-     list    
startweights            100 -none-     list    
result.matrix       1153000 -none-     numeric 
In [15]:
face.classifier.5 <- neuralnet(myform, training.set, hidden = 5, rep=100, linear.output = FALSE, threshold = 0.1)
summary(face.classifier.5)
                    Length  Class      Mode    
call                      7 -none-     call    
response                 80 -none-     numeric 
covariate            307200 -none-     numeric 
model.list                2 -none-     list    
err.fct                   1 -none-     function
act.fct                   1 -none-     function
linear.output             1 -none-     logical 
data                   3841 data.frame list    
exclude                   0 -none-     NULL    
net.result              100 -none-     list    
weights                 100 -none-     list    
generalized.weights     100 -none-     list    
startweights            100 -none-     list    
result.matrix       1921400 -none-     numeric 
In [16]:
face.classifier.7 <- neuralnet(myform, training.set, hidden = 7, rep=100, linear.output = FALSE, threshold = 0.1)
summary(face.classifier.7)
                    Length  Class      Mode    
call                      7 -none-     call    
response                 80 -none-     numeric 
covariate            307200 -none-     numeric 
model.list                2 -none-     list    
err.fct                   1 -none-     function
act.fct                   1 -none-     function
linear.output             1 -none-     logical 
data                   3841 data.frame list    
exclude                   0 -none-     NULL    
net.result              100 -none-     list    
weights                 100 -none-     list    
generalized.weights     100 -none-     list    
startweights            100 -none-     list    
result.matrix       2689800 -none-     numeric 
In [17]:
face.classifier.9 <- neuralnet(myform, training.set, hidden = 9, rep=100, linear.output = FALSE, threshold = 0.1)
summary(face.classifier.9)
                    Length  Class      Mode    
call                      7 -none-     call    
response                 80 -none-     numeric 
covariate            307200 -none-     numeric 
model.list                2 -none-     list    
err.fct                   1 -none-     function
act.fct                   1 -none-     function
linear.output             1 -none-     logical 
data                   3841 data.frame list    
exclude                   0 -none-     NULL    
net.result              100 -none-     list    
weights                 100 -none-     list    
generalized.weights     100 -none-     list    
startweights            100 -none-     list    
result.matrix       3458200 -none-     numeric 
In [18]:
face.classifier.11 <- neuralnet(myform, training.set, hidden = 11, rep=100, linear.output = FALSE, threshold = 0.1)
summary(face.classifier.11)
                    Length  Class      Mode    
call                      7 -none-     call    
response                 80 -none-     numeric 
covariate            307200 -none-     numeric 
model.list                2 -none-     list    
err.fct                   1 -none-     function
act.fct                   1 -none-     function
linear.output             1 -none-     logical 
data                   3841 data.frame list    
exclude                   0 -none-     NULL    
net.result              100 -none-     list    
weights                 100 -none-     list    
generalized.weights     100 -none-     list    
startweights            100 -none-     list    
result.matrix       4226600 -none-     numeric 

Next we use the models we have built to make predictions on the test set:

In [19]:
class.index<-length(test.set)
face.prediction.3<-compute(face.classifier.3,test.set[,-class.index])
face.prediction.3$net.result
i.vector0.05375460
i.vector.60.05375460
i.vector.70.05375460
i.vector.80.89221862
i.vector.210.05375460
i.vector.280.05375460
i.vector.310.05375460
i.vector.400.05375460
i.vector.430.05460419
i.vector.450.05375460
i.vector.460.05375460
image.vector10.89221862
i.vector.1210.89221862
i.vector.1410.89221862
i.vector.2310.89221862
i.vector.3410.89221862
i.vector.3510.89221862
i.vector.4210.07080363
i.vector.4310.89221862
i.vector.4810.89221862
In [20]:
face.prediction.5<-compute(face.classifier.5,test.set[,-class.index])
face.prediction.5$net.result
i.vector0.06708747
i.vector.60.06613341
i.vector.70.06613332
i.vector.80.06626713
i.vector.210.06614828
i.vector.280.06613332
i.vector.310.06613335
i.vector.400.06613332
i.vector.430.51652668
i.vector.450.06613746
i.vector.460.06620899
image.vector10.95585924
i.vector.1210.95581684
i.vector.1410.95573193
i.vector.2310.95563006
i.vector.3410.95585924
i.vector.3510.95585924
i.vector.4210.94444754
i.vector.4310.95583787
i.vector.4810.95585924
In [21]:
face.prediction.7<-compute(face.classifier.7,test.set[,-class.index])
face.prediction.7$net.result
i.vector0.007259566
i.vector.60.005776780
i.vector.70.003738080
i.vector.80.035216561
i.vector.210.029349089
i.vector.280.003738107
i.vector.310.003738038
i.vector.400.003738041
i.vector.430.279152314
i.vector.450.003739558
i.vector.460.004209081
image.vector10.947813500
i.vector.1210.940423054
i.vector.1410.962253749
i.vector.2310.707958860
i.vector.3410.969053064
i.vector.3510.967021327
i.vector.4210.968997771
i.vector.4310.967209372
i.vector.4810.969053048
In [22]:
face.prediction.9<-compute(face.classifier.9, test.set[,-class.index])
face.prediction.9$net.result
i.vector1.610229e-04
i.vector.61.846180e-05
i.vector.71.095648e-04
i.vector.82.580134e-02
i.vector.211.108791e-04
i.vector.281.795596e-05
i.vector.311.830093e-05
i.vector.401.795683e-05
i.vector.437.442605e-03
i.vector.451.268788e-04
i.vector.461.132006e-04
image.vector19.554436e-01
i.vector.1219.553886e-01
i.vector.1419.554247e-01
i.vector.2319.554339e-01
i.vector.3419.554436e-01
i.vector.3519.554436e-01
i.vector.4218.136309e-01
i.vector.4319.554120e-01
i.vector.4819.222663e-01
In [23]:
face.prediction.11<-compute(face.classifier.11,test.set[,-class.index])
face.prediction.11$net.result
i.vector0.20132563
i.vector.60.03375570
i.vector.70.03375610
i.vector.80.34779632
i.vector.210.25306999
i.vector.280.03375542
i.vector.310.03376119
i.vector.400.03404698
i.vector.430.03436065
i.vector.450.37902962
i.vector.460.24580260
image.vector10.98332955
i.vector.1210.33759202
i.vector.1410.33413828
i.vector.2310.98271765
i.vector.3410.98322664
i.vector.3510.98332158
i.vector.4210.11258902
i.vector.4310.98333099
i.vector.4810.98325884
In [24]:
classifications.3<-ifelse(face.prediction.3$net.result>0.5,1,0)
classifications.3
i.vector0
i.vector.60
i.vector.70
i.vector.81
i.vector.210
i.vector.280
i.vector.310
i.vector.400
i.vector.430
i.vector.450
i.vector.460
image.vector11
i.vector.1211
i.vector.1411
i.vector.2311
i.vector.3411
i.vector.3511
i.vector.4210
i.vector.4311
i.vector.4811
In [25]:
classifications.5<-ifelse(face.prediction.5$net.result>0.5,1,0)
classifications.5
i.vector0
i.vector.60
i.vector.70
i.vector.80
i.vector.210
i.vector.280
i.vector.310
i.vector.400
i.vector.431
i.vector.450
i.vector.460
image.vector11
i.vector.1211
i.vector.1411
i.vector.2311
i.vector.3411
i.vector.3511
i.vector.4211
i.vector.4311
i.vector.4811
In [26]:
classifications.7<-ifelse(face.prediction.7$net.result>0.5,1,0)
classifications.7
i.vector0
i.vector.60
i.vector.70
i.vector.80
i.vector.210
i.vector.280
i.vector.310
i.vector.400
i.vector.430
i.vector.450
i.vector.460
image.vector11
i.vector.1211
i.vector.1411
i.vector.2311
i.vector.3411
i.vector.3511
i.vector.4211
i.vector.4311
i.vector.4811
In [27]:
classifications.9<-ifelse(face.prediction.9$net.result>0.5,1,0)
classifications.9
i.vector0
i.vector.60
i.vector.70
i.vector.80
i.vector.210
i.vector.280
i.vector.310
i.vector.400
i.vector.430
i.vector.450
i.vector.460
image.vector11
i.vector.1211
i.vector.1411
i.vector.2311
i.vector.3411
i.vector.3511
i.vector.4211
i.vector.4311
i.vector.4811
In [28]:
classifications.11<-ifelse(face.prediction.11$net.result>0.5,1,-1)
classifications.11
i.vector-1
i.vector.6-1
i.vector.7-1
i.vector.8-1
i.vector.21-1
i.vector.28-1
i.vector.31-1
i.vector.40-1
i.vector.43-1
i.vector.45-1
i.vector.46-1
image.vector1 1
i.vector.121-1
i.vector.141-1
i.vector.231 1
i.vector.341 1
i.vector.351 1
i.vector.421-1
i.vector.431 1
i.vector.481 1

Then we show the confusion matrix for all 5 classifiers:

In [29]:
table(test.set[,class.index],classifications.3)
   classifications.3
     0  1
  0 10  1
  1  1  8
In [30]:
table(test.set[,class.index],classifications.5)
   classifications.5
     0  1
  0 10  1
  1  0  9
In [31]:
table(test.set[,class.index],classifications.7)
   classifications.7
     0  1
  0 11  0
  1  0  9
In [32]:
table(test.set[,class.index],classifications.9)
   classifications.9
     0  1
  0 11  0
  1  0  9
In [33]:
table(test.set[,class.index],classifications.11)
   classifications.11
    -1  1
  0 11  0
  1  3  6

We summarize the accuracy results of all classifiers in a table:

In [34]:
accuracy.vector<-c(0.5, 0.95, 0.5, 1, 1)
hidden.vector<-c(3, 5, 7, 9, 11)
accuracy.frame<-data.frame(as.data.frame(accuracy.vector))
hidden.frame<-data.frame(as.data.frame(hidden.vector))
final.frame<-cbind(accuracy.frame, hidden.frame)
names(final.frame)<-c("Accuracy", "Hidden Nodes")
final.frame
AccuracyHidden Nodes
0.50 3
0.95 5
0.50 7
1.00 9
1.0011